package com.molichuxing.services.infrastructure.dao;

import com.molichuxing.framework.dao.RootMapper;
import com.molichuxing.services.infrastructure.bean.AccountBean;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface AccountMapper extends RootMapper<AccountBean> {

    /**
     * 获取有效的账户信息
     *
     * @param account    账户
     * @param systemType 系统类型
     * @return
     */
    AccountBean getAccount(@Param("account") String account, @Param("systemType") Integer systemType);

    /**
     * 根据条件获得符合条件的后台用户
     *
     * @param param
     * @param pageNum
     * @param pageSize
     * @return
     */
    List<AccountBean> getAccountList(@Param("param") Map<String, Object> param, @Param("pageNum") int pageNum, @Param("pageSize") int pageSize);

    /**
     * 根据条件获得符合条件的后台用户数量
     *
     * @param param
     * @return
     */
    int getAccountCount(@Param("param") Map<String, Object> param);

    /**
     * 创建用户
     *
     * @param bean
     * @return
     */
    int createAccount(AccountBean bean);

    int modifyAccount(AccountBean bean);

    AccountBean getById(int id);

    int modifyPassword(@Param("password") String password, @Param("id") int id);

    AccountBean getIovAccount();

    int modifyAccountByIov(AccountBean bean);

    List<AccountBean> getAccountByParam(@Param("param") Map<String, Object> param);

    int modifyPasswordByIov(@Param("password") String password, @Param("account") String account);

    /**
     * 禁用用户
     * @param ids
     * @return
     */
    int modifyAccountToDisable(@Param("ids") List<Integer> ids);

    /**
     * 启用用户
     * @param ids
     * @return
     */
    int modifyAccountStatusToOpen(@Param("ids") List<Integer> ids);
}